= gitlab_ui_form_for @group, html: { multipart: true, class: 'gl-show-field-errors js-general-permissions-form' }, authenticity_token: true do |f|
  %input{ type: 'hidden', name: 'update_section', value: 'js-permissions-settings' }
  = form_errors(@group)

  %fieldset
    %h5= _('Permissions')
    - if show_prevent_inviting_groups_outside_hierarchy_setting?(@group)
      .form-group.gl-mb-3
        = f.gitlab_ui_checkbox_component :prevent_sharing_groups_outside_hierarchy,
            s_('GroupSettings|Members cannot invite groups outside of %{group} and its subgroups').html_safe % { group: link_to_group(@group) },
            help_text: prevent_sharing_groups_outside_hierarchy_help_text(@group),
            checkbox_options: { disabled: !can_change_prevent_sharing_groups_outside_hierarchy?(@group) }

    .form-group.gl-mb-3
      = f.gitlab_ui_checkbox_component :share_with_group_lock,
          s_('GroupSettings|Projects in %{group} cannot be shared with other groups').html_safe % { group: link_to_group(@group) },
          checkbox_options: { disabled: !can_change_share_with_group_lock?(@group) },
          help_text: share_with_group_lock_help_text(@group)

    .form-group.gl-mb-3
      = f.gitlab_ui_checkbox_component :mentions_disabled,
          s_('GroupSettings|Group mentions are disabled'),
          checkbox_options: { checked: @group.mentions_disabled? },
          help_text: s_('GroupSettings|Group members are not notified if the group is mentioned.')
    = render 'groups/settings/email_settings', f: f, group: @group
    = render 'groups/settings/ip_restriction_registration_features_cta', f: f
    = render_if_exists 'groups/settings/ip_restriction', f: f, group: @group
    = render_if_exists 'groups/settings/allowed_email_domain', f: f, group: @group
    - if @group.licensed_feature_available?(:group_wikis)
      = render_if_exists 'groups/settings/wiki', f: f, group: @group
    = render 'groups/settings/lfs', f: f
    = render_if_exists 'groups/settings/product_analytics_settings', f: f, group: @group
    = render 'groups/settings/git_access_protocols', f: f, group: @group
    = render 'groups/settings/project_creation_level', f: f, group: @group
    = render 'groups/settings/subgroup_creation_level', f: f, group: @group
    = render_if_exists 'groups/settings/prevent_forking', f: f, group: @group

    - if @group.enterprise_user_settings_available?(current_user)
      %fieldset.form-group.gl-form-group
        %legend.col-form-label.col-form-label
          = s_('GroupSettings|Enterprise users')
          .label-description
            = s_('GroupSettings|Settings that apply only to enterprise users associated with this group.')
        = render_if_exists 'groups/settings/enterprise_users_pats', f: f, group: @group
        = render_if_exists 'groups/settings/enterprise_users_ssh_keys', f: f, group: @group
        = render_if_exists 'groups/settings/hide_email_on_profile', f: f, group: @group
        = render_if_exists 'groups/settings/extensions_marketplace', f: f, group: @group
        = render_if_exists 'groups/settings/allow_personal_snippets', f: f, group: @group
    = render_if_exists 'groups/settings/personal_access_tokens', f: f, group: @group
    = render 'groups/settings/resource_access_token_creation', f: f, group: @group
    = render_if_exists 'groups/personal_access_token_expiration_policy', f: f, group: @group
    = render_if_exists 'groups/settings/extended_grat_expiry_webhook_execute', f: f, group: @group
    = render_if_exists 'groups/settings/enforce_ssh_certificates', f: f, group: @group
    = render 'groups/settings/two_factor_auth', f: f, group: @group
    - if Feature.enabled?(:omniauth_step_up_auth_for_namespace, @group)
      = render 'groups/settings/step_up_authentication', f: f, group: @group
    = render 'groups/settings/membership', f: f, group: @group
    = render_if_exists 'groups/settings/placeholder_confirmation_bypass', f: f, group: @group
    = render_if_exists 'groups/settings/remove_dormant_members', f: f, group: @group
    = render_if_exists 'groups/settings/disable_invite_members', f: f, group: @group
    = render_if_exists 'groups/settings/pages_access_control', f: f, group: @group
    = render_if_exists 'groups/settings/crm', f: f, group: @group
    = render_if_exists 'groups/settings/secret_manager', f: f, group: @group

  = f.submit _('Save changes'), pajamas_button: true, class: 'gl-mt-3', data: { testid: 'save-permissions-changes-button' }
